from http.client import responses

from Tools.scripts.generate_opcode_h import header

from a3mall.conftest import login_token,client
import logging

import allure
import pytest
from a3mall.Tools.logger import logger
from a3mall.Tools.tools import ApiClient
from a3mall.utils.load_data import *
from a3mall.Tools.mysql import db

class Test_a3mall():
    # 积分列表详情
    def test_points_list(self,client,login_token):
        token = login_token
        headers = {'auth-token': token}
        responses = client.get(path='/api/point?page=1&type=0&sort=1')
        print(responses.json())
    def test_shop(self,client,login_token):
        token = login_token
        headers = {'auth-token':token}
        responses = client.get(path='/api/point/view?id=2')
        print(responses.json())
    def test_points(self,client,login_token):
        token = login_token
        headers = {'auth-token':token}
        responses = client.get(path='/api/order/confirm?id=2&type=point&sku_id=&num=1&shipping_type=1',headers=headers)
        print(responses.json())
    def test_pay(self,client,login_token):
        token = login_token
        headers = {'auth-token':token}
        data = {
  "id": "2",
  "type": "point",
  "address_id": 61,
  "store_id": 1,
  "shipping_type": 1,
  "bonus_id": "0",
  "payment": "balance",
  "remarks": "",
  "source": 1,
  "url": "http://10.59.9.12:7001/wap/pages/cart/confirm?id=2&sku_id=&num=1&type=point",
  "sku_id": "",
  "num": "1"
}
        responses = client.post(path='/api/order/create',json_data=data,headers=headers)
        print(responses.json())